package cate.game.train.rune.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTrain;
import cate.game.res.MixRes;
import easy.java.dev.note.NoteField;

import java.util.List;

@ClientMsg(title=  "徽章强化 の 请求")
@OperationSetter(GDOperation.RUNE_LEVEL_UP)
public class RuneLevelUpReq implements MsgInput {
    @NoteField(value = "徽章ID", detail = "需要强化的徽章")
    public String runeUid;

    @NoteField(value = "英雄ID", detail = "如果是英雄身上的徽章还需要传英雄id")
    public String heroUid;

    @NoteField(value = "部位ID", detail = "如果是英雄身上的徽章还需传部位id")
    public byte pos;

    @NoteField(value = "用于吞噬的徽章id")
    public List<String> runeList;

    @NoteField(value = "被吞噬的经验徽章们")
    public MixRes consume;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult<Void> r = game.train.rune.runeLevelUp(cc.getRole(), runeUid, heroUid, pos, runeList, consume);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r.message);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTrain.RUNE_LEVEL_UP_REQ;
    }
}
